package model

import (
	"gorm.io/gorm"
	"week2zk-project/rpc/global"
)

//订单表

type Order struct {
	gorm.Model
	UserId     int    `gorm:"type:int(10);not null;"`
	GoodsId    int    `gorm:"type:int(10);not null;"`
	GoodsTitle string `gorm:"type:varchar(40);not null;"`
	GoodsPrice int64  `gorm:"type:int(3);not null;"`
	Num        int64  `gorm:"type:int(3);not null;comment:购买数量"`
	SumPrice   int64  `gorm:"type:int(3);not null;comment:总金额"`
}

func (o *Order) Create() error {
	return global.DB.Create(&o).Error
}
